header cleanout
authorØyvind Kolås <ok@src.gnome.org>
Wed, 31 Aug 2005 14:47:46 +0000 (14:47 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Wed, 31 Aug 2005 14:47:46 +0000 (14:47 +0000)
55 files changed:
ChangeLog
babl/Makefile.am
babl/babl-classes.h
babl/babl-component.c
babl/babl-component.h [deleted file]
babl/babl-conversion.c
babl/babl-conversion.h [deleted file]
babl/babl-core.c
babl/babl-core.h [deleted file]
babl/babl-db.h
babl/babl-extension.c
babl/babl-extension.h [deleted file]
babl/babl-fish.c
babl/babl-fish.h [deleted file]
babl/babl-format.c
babl/babl-format.h [deleted file]
babl/babl-image.c
babl/babl-image.h [deleted file]
babl/babl-instance.h [deleted file]
babl/babl-internal.c
babl/babl-internal.h
babl/babl-introspect.c
babl/babl-introspect.h [deleted file]
babl/babl-memory.c
babl/babl-model.c
babl/babl-model.h [deleted file]
babl/babl-sampling.c
babl/babl-sampling.h [deleted file]
babl/babl-sanity.c
babl/babl-sanity.h [deleted file]
babl/babl-type.c
babl/babl-type.h [deleted file]
babl/babl.c
babl/babl.h
babl/base/model-cmyk.c
babl/base/model-gray.c
babl/base/model-rgb.c
babl/base/model-ycbcr.c
babl/base/type-float.c
babl/base/type-u16.c
babl/base/type-u8.c
docs/index-static.html.in
extensions/CIE-Lab.c
extensions/naive-CMYK.c
tests/babl-html-dump.c
tests/babl_class_name.c
tests/grayscale_to_rgb.c
tests/introspect.c
tests/models.c
tests/nop.c
tests/rgb_to_bgr.c
tests/rgb_to_ycbcr.c
tests/sanity.c
tests/srgb_to_lab_u8.c
tests/types.c

index 7f8f2be9820e91b418aa6c756b0c225a26f2108a..70f0f34bb58344cf3ed9d3a8eb5d664523f5d460 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,65 @@
+2005-08-31  Øyvind Kolås  <pippin@gimp.org>
+
+       * babl/babl-component.h,
+       * babl/babl-core.h,
+       * babl/babl-conversion.h,
+       * babl/babl-extension.h,
+       * babl/babl-format.h,
+       * babl/babl-instance.h,
+       * babl/babl-introspect.h,
+       * babl/babl-image.h,
+       * babl/babl-fish.h,
+       * babl/babl-model.h,
+       * babl/babl-sampling.h,
+       * babl/babl-sanity.h,
+       * babl/babl-type.h: DELETED
+       * babl/babl.h: defines moved from deleted headers. Added
+       documentation.
+       * babl/babl-internal.h: defines moved from deleted headers.
+
+       * babl/Makefile.am: Reflect above changes.
+       * babl/babl-classes.h: redefined conversion functions to return long,
+       and take number of pixels as long.
+       * babl/babl-component.c, 
+       * babl/babl-conversion.c,
+       * babl/babl-core.c,
+       * babl/babl-db.h,
+       * babl/babl-extension.c,
+       * babl/babl-fish.c, 
+       * babl/babl-format.c,
+       * babl/babl-image.c, 
+       * babl/babl-instance.h,
+       * babl/babl-internal.c,
+       * babl/babl-internal.h,
+       * babl/babl-introspect.c,
+       * babl/babl-memory.c, 
+       * babl/babl-model.c,
+       * babl/babl-sampling.c,
+       * babl/babl-sanity.c,
+       * babl/babl-type.c, 
+       * babl/babl.c,
+       * babl/base/model-cmyk.c,
+       * babl/base/model-gray.c, 
+       * babl/base/model-rgb.c, 
+       * babl/base/model-ycbcr.c,
+       * babl/base/type-float.c,
+       * babl/base/type-u16.c,
+       * babl/base/type-u8.c, 
+       * docs/index-static.html.in,
+       * extensions/CIE-Lab.c,
+       * extensions/naive-CMYK.c, 
+       * tests/babl-html-dump.c,
+       * tests/babl_class_name.c,
+       * tests/grayscale_to_rgb.c,
+       * tests/introspect.c,
+       * tests/models.c,
+       * tests/nop.c,
+       * tests/rgb_to_bgr.c,
+       * tests/rgb_to_ycbcr.c,
+       * tests/sanity.c,
+       * tests/srgb_to_lab_u8.c,
+       * tests/types.c: reflect changes in headers.
+
 2005-08-31  Øyvind Kolås  <pippin@gimp.org>
 
        * Makefile.am,
index c78df671a84334ebb2d3d866d567e1ab21f9add5..630a672af2eeb382474ff4832934c6d6ec0588b1 100644 (file)
@@ -22,41 +22,16 @@ c_sources =                         \
 
 h_sources  =                           \
        babl-classes.h                  \
-       babl-component.h                \
-       babl-core.h                     \
-       babl-conversion.h               \
        babl-db.h                       \
-       babl-extension.h                \
-       babl-format.h                   \
        babl-ids.h                      \
-       babl-instance.h                 \
        babl-internal.h                 \
-       babl-introspect.h               \
-       babl-image.h                    \
-       babl-fish.h                     \
        babl-memory.h                   \
-       babl-model.h                    \
-       babl-sampling.h                 \
-       babl-sanity.h                   \
-       babl-type.h                     \
        babl-util.h                     \
        babl.h
 
 library_includedir=$(includedir)/babl-$(BABL_API_VERSION)/babl
 library_include_HEADERS =              \
-       babl.h                          \
-       babl-classes.h                  \
-       babl-component.h                \
-       babl-conversion.h               \
-       babl-extension.h                \
-       babl-fish.h                     \
-       babl-ids.h                      \
-       babl-image.h                    \
-       babl-instance.h                 \
-       babl-model.h                    \
-       babl-format.h                   \
-       babl-sampling.h                 \
-       babl-type.h
+       babl.h
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/babl/base
 
index f6850b4f4e29f4ecc58e0456ba64b90eb1d38a12..8285a86ff328406c107c91c6d1f21f410ab702a7 100644 (file)
 #define _BABL_CLASSES_H
 
 /* Type and Format */
-typedef void (*BablFuncLinear)    (void  *src,
+typedef long (*BablFuncLinear)    (void  *src,
                                    void  *dst,
                                    int    src_pitch,
                                    int    dst_pitch,
-                                   int    n);
+                                   long   n);
 
 /* TypePlanar, ModelPlanar and FormatPlanar */
-typedef void (*BablFuncPlanar)    (int    src_bands,
+typedef long (*BablFuncPlanar)    (int    src_bands,
                                    void  *src[],
                                    int    src_pitch[],
                                    int    dst_bands,
                                    void  *dst[],
                                    int    dst_pitch[],
-                                   int    n);
+                                   long   n);
 
-typedef void (*BablFuncPlanarBit) (int    src_bands,
+typedef long (*BablFuncPlanarBit) (int    src_bands,
                                    void  *src[],
                                    int    src_bit[],
                                    int    src_pitch[],
@@ -46,7 +46,7 @@ typedef void (*BablFuncPlanarBit) (int    src_bands,
                                    int    dst_bit[],
                                    int    dst_pitch[],
                                    int    dst_bit_pitch[],
-                                   int    n);
+                                   long   n);
 
 /* magic number used at the start of all babl objects, used to do
  * differentiation in polymorphic functions. (as well as manual
index c0f76045c4f4e45224e77a52e36a8357939092c4..46855ca9da78c474677c4e725460f9ae03f51889 100644 (file)
@@ -58,7 +58,7 @@ component_new (const char *name,
 }
 
 Babl *
-babl_component_new (const char *name,
+babl_component_new (void *first_arg,
                     ...)
 {
   va_list     varg;
@@ -67,9 +67,9 @@ babl_component_new (const char *name,
   int         luma    = 0;
   int         chroma  = 0;
   int         alpha   = 0;
-  const char *arg=name;
+  const char *arg=(char*)first_arg;
 
-  va_start (varg, name);
+  va_start (varg, first_arg);
   
   while (1)
     {
@@ -108,13 +108,13 @@ babl_component_new (const char *name,
       
       else
         {
-          babl_fatal ("unhandled argument '%s' for format '%s'", arg, name);
+          babl_fatal ("unhandled argument '%s' for format '%s'", arg, first_arg);
         }
     }
     
   va_end   (varg);
 
-  babl = component_new (name, id, luma, chroma, alpha);
+  babl = component_new (first_arg, id, luma, chroma, alpha);
 
   { 
     Babl *ret = db_insert (babl);
@@ -124,4 +124,4 @@ babl_component_new (const char *name,
   }
 }
 
-BABL_CLASS_TEMPLATE (babl_component)
+BABL_CLASS_TEMPLATE (component)
diff --git a/babl/babl-component.h b/babl/babl-component.h
deleted file mode 100644 (file)
index 6ad5d8c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_COMPONENT_H
-#define _BABL_COMPONENT_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-
-BABL_DEFINE_CLASS (babl_component)
-#endif
index d400ca3b771376f95f5e26ffbb5b11bde264e1e5..38859d0716fdcfd0bc5f770c81112a32ed63a887 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "babl-internal.h"
 #include "babl-db.h"
-#include "babl-extension.h"
-#include "assert.h"
 #include <string.h>
 #include <stdarg.h>
 
@@ -146,9 +144,7 @@ create_name (Babl *source, Babl *destination)
 }
 
 Babl *
-babl_conversion_new (Babl *source,
-                     Babl *destination,
-                     void *first_arg,
+babl_conversion_new (void *first_arg,
                      ...)
 {
   va_list            varg;
@@ -164,12 +160,18 @@ babl_conversion_new (Babl *source,
   int                got_func    = 0;
   const char        *arg         = first_arg;
 
+  Babl *source;
+  Babl *destination;
+
+  va_start (varg, first_arg);
+  source = (Babl*) arg;
+  destination = va_arg (varg, Babl*);
+  arg = va_arg (varg, char *);
+
   assert (BABL_IS_BABL(source));
   assert (BABL_IS_BABL(destination));
   
-  va_start (varg, first_arg);
-  
-  while (1)
+  while (arg)
     {
      
       if (!strcmp (arg, "id"))
@@ -218,8 +220,6 @@ babl_conversion_new (Babl *source,
         }
 
       arg = va_arg (varg, char *);
-      if (!arg)
-        break;
     }
     
   va_end   (varg);
@@ -238,7 +238,7 @@ babl_conversion_new (Babl *source,
   }
 }
 
-static void
+static long
 babl_conversion_linear_process (BablConversion *conversion,
                                 void           *source,
                                 void           *destination,
@@ -247,9 +247,10 @@ babl_conversion_linear_process (BablConversion *conversion,
                                 long            n)
 {
   conversion->function.linear (source, destination, src_pitch, dst_pitch, n);
+  return n;
 }
 
-static void
+static long
 babl_conversion_planar_process (BablConversion *conversion,
                                 BablImage      *source,
                                 BablImage      *destination,
@@ -273,20 +274,16 @@ babl_conversion_planar_process (BablConversion *conversion,
                                dst_data,
                                destination->pitch,
                                n);
+  return n;
 }
 
-/* this is the place to insert usage instrumentation into babl */
-void
+long
 babl_conversion_process (BablConversion *conversion,
                          void           *source,
                          void           *destination,
                          long            n)
 {
-  /*TODO: build planar formats if needed when linear pointers are passed in */
-  assert (BABL_IS_BABL (conversion));
-
-  conversion->processings++;
-  conversion->pixels += n;
+  babl_assert (BABL_IS_BABL (conversion));
 
   switch (BABL(conversion)->class_type)
   {
@@ -331,8 +328,8 @@ babl_conversion_process (BablConversion *conversion,
       }
       break;
     case BABL_CONVERSION_MODEL_PLANAR:
-      assert (BABL_IS_BABL (source));
-      assert (BABL_IS_BABL (destination));
+      babl_assert (BABL_IS_BABL (source));
+      babl_assert (BABL_IS_BABL (destination));
 
       babl_conversion_planar_process (                  conversion,
                                       (BablImage*)      source, 
@@ -343,9 +340,10 @@ babl_conversion_process (BablConversion *conversion,
       babl_log ("args=(%s, %p, %p, %li) unhandled conversion type: %s",
            conversion->instance.name, source, destination, n,
           babl_class_name (conversion->instance.class_type));
+      return 0;
       break;
   }
-          
+  return n;
 }
 
-BABL_CLASS_TEMPLATE (babl_conversion)
+BABL_CLASS_TEMPLATE (conversion)
diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h
deleted file mode 100644 (file)
index e33a44b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef BABL_CONVERSION_H
-#define BABL_CONVERSION_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-void   babl_conversion_process (BablConversion *conversion,
-                                void           *source,
-                                void           *destination,
-                                long            n);
-
-Babl * babl_conversion_new     (Babl           *source,
-                                Babl           *destination,
-                                void           *first_argument,
-                                ...);
-
-BABL_DEFINE_CLASS_NO_NEW (babl_conversion);
-#endif
index 8fd50a411cfbac23e129f004c6b54c44f5814432..d5fff5e20d902e37a2242ad0aef40713f8b7318a 100644 (file)
 #include "babl-ids.h"
 #include "util.h"
 
-static void
+static long
 convert_double_double (void *src,
                        void *dst,
                        int   src_pitch,
                        int   dst_pitch,
-                       int   n)
+                       long  n)
 {
   if (src_pitch == 64 &&
       dst_pitch == 64)
     {
       memcpy (dst, src, n/8);
-      return;
+      return n;
     }
+
   while (n--)
     {
       (*(double *) dst) = (*(double *) src);
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
 
-static void
+static long
 copy_strip_1 (int    src_bands,
               void **src,
               int   *src_pitch,
               int    dst_bands,
               void **dst,
               int   *dst_pitch,
-              int    n)
+              long   n)
 {
   BABL_PLANAR_SANITY
   while (n--)
@@ -70,6 +72,7 @@ copy_strip_1 (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 void
diff --git a/babl/babl-core.h b/babl/babl-core.h
deleted file mode 100644 (file)
index e75909c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef BABL_CORE_H
-#define BABL_CORE_H
-
-void babl_core_init (void);
-
-#endif
index 14c0d34e600b63bf70da54d3ad21397f1a63d835..883f81ab923b306aeec9525bb0d224c8632356b4 100644 (file)
 #define _DB_H
 
 #ifndef _BABL_INTERNAL_H
-#error  babl-internal.h must be included before babl-db.h, babl-db.h is strictly internal to babl core classes.
+#error  babl-db.h is only to be included after babl-internal.h
 #endif
 
-#include "babl-instance.h"
-#include "babl-extension.h"
-
 #include <string.h>
 
 #define DB_DEF             static inline
@@ -116,19 +113,7 @@ db_insert (Babl *babl)
   collision = db_exist (babl->instance.id, babl->instance.name);
 
   if (collision)
-    {
-#if 0
-      if (!strcmp (collision->instance.name, babl->instance.name)    )
-        babl_log ("conflicting name:\n\t\tnew: '%s'\n\t\texisting '%s' from %s",
-                babl->instance.name, collision->instance.name,
-                collision->instance.creator?BABL(collision->instance.creator)->instance.name:"core");
-      else if (collision->instance.id == babl->instance.id)
-        babl_log ("conflicting id:\n\t\tnew: '%s' (id=%i)\n\t\texisting '%s' from %s",
-                babl->instance.name, babl->instance.id, collision->instance.name,
-                collision->instance.creator?BABL(collision->instance.creator)->instance.name:"core");
-#endif
-      return collision;
-    }
+     return collision;
 
   if (db_entries + 1 > db_size)     /* must reallocate storage */
     {
@@ -169,31 +154,29 @@ db_each (BablEachFunction  each_fun,
     }
 }
 
-typedef struct DbExistData
+typedef struct BablDbExistData
 {
   unsigned int  type;
   int           id;
   const char   *name;
   Babl         *ret;
-} DbExistData;
+} BablDbExistData;
 
 DB_DEF int 
 db_each_exist (Babl *babl,
                void *void_data)
 {
-  DbExistData *data = void_data;
+  BablDbExistData *data = void_data;
 
-  if (data->id &&
-      data->id == babl->instance.id)
+  if (data->id && data->id == babl->instance.id)
     {
-      data->ret = babl;
-      return 1;
+          data->ret = babl;
+          return 1; /* stop iterating */
     }
-  if (data->name &&
-      !strcmp (babl->instance.name, data->name))
+  else if (data->name && !strcmp (babl->instance.name, data->name))
     {
       data->ret = babl;
-      return 1;
+      return 1; /* stop iterating */
     }
   return 0;  /* continue iterating */
 }
@@ -202,7 +185,7 @@ DB_DEF Babl *
 db_exist (int         id,
           const char *name)
 {
-  DbExistData data;
+  BablDbExistData data;
 
   data.id = id;
   data.name = name;
index 6954eb99828c2c01d0eaf5bd0606115559dabe45..26ca1f8bb3e1692b96ea2ba2f4737a8c03f15b4b 100644 (file)
  */
 
 #define BABL_DYNAMIC_EXTENSIONS
-#define BABL_PATH           "/usr/lib/babl:/usr/local/lib/babl:~/.babl";
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#define BABL_PATH           "~/.babl-0.0:/usr/local/lib/babl-0.0:/usr/lib/babl-0.0";
 #define BABL_PATH_SEPERATOR "/"
 #define BABL_LIST_SEPERATOR ':'
+#endif
 
 
 
@@ -131,7 +136,6 @@ destroy_hook (void)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <dlfcn.h>
 #ifndef RTLD_NOW
@@ -336,4 +340,4 @@ each_babl_extension_destroy (Babl *babl,
   return 0;  /* continue iterating */
 }
 
-BABL_CLASS_TEMPLATE (babl_extension)
+BABL_CLASS_TEMPLATE (extension)
diff --git a/babl/babl-extension.h b/babl/babl-extension.h
deleted file mode 100644 (file)
index 3de0c58..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_EXTENSION_H
-#define _BABL_EXTENSION_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-Babl       * babl_extension_base      (void);
-
-Babl       * babl_extender            (void);
-void         babl_set_extender        (Babl *new_extender);
-
-Babl       * babl_extension_quiet_log (void);
-
-BABL_DEFINE_CLASS (babl_extension)
-#endif
index 442bc7fed2deabf37a57dee85e6aad7355604bd1..bdc87d88e76406bc4ad90e58532e736adb20c553 100644 (file)
 
 #include "babl-internal.h"
 #include "babl-db.h"
-#include "assert.h"
 #include <string.h>
 #include <stdarg.h>
 
-#include "babl-type.h"
+/*#include "babl-type.h"
 #include "babl-model.h"
 #include "babl-image.h"
 #include "babl-component.h"
-#include "babl-format.h"
+#include "babl-format.h"*/
 
 static int 
 each_babl_fish_destroy (Babl *babl,
@@ -51,38 +50,6 @@ create_name (Babl *source,
   return buf;
 }
 
-Babl *
-babl_fish_new (Babl *source,
-               Babl *destination)
-{
-  Babl *babl = NULL;
-  const char *name;
-
-  assert (BABL_IS_BABL (source));
-  assert (BABL_IS_BABL (destination));
-  
-  name = create_name (source, destination, 0);
-
-  babl                   = babl_malloc (sizeof (BablFishReference) +
-                                        strlen (name) + 1);
-  babl->class_type       = BABL_FISH;
-  babl->instance.id      = 0;
-  babl->instance.name    = ((void *)babl) + sizeof(BablFishReference);
-  strcpy (babl->instance.name, name);
-  babl->fish.source      = (union Babl*)source;
-  babl->fish.destination = (union Babl*)destination;
-
-  babl->fish.processings = 0;
-  babl->fish.pixels      = 0;
-
-  { 
-    Babl *ret = db_insert (babl);
-    if (ret!=babl)
-        babl_free (babl);
-    return ret;
-  }
-}
-
 typedef struct SearchData
 {
   Babl           *source;
@@ -90,8 +57,8 @@ typedef struct SearchData
   BablConversion *result;
 } SearchData;
 
-BablConversion *babl_conversion_find (void *source,
-                                      void *destination)
+Babl *babl_conversion_find (void *source,
+                            void *destination)
 {
   int i=0;
   Babl **conversion;
@@ -100,7 +67,7 @@ BablConversion *babl_conversion_find (void *source,
   while (conversion[i])
     {
       if (conversion[i]->conversion.destination == destination)
-        return (BablConversion*)conversion[i];
+        return (Babl*)conversion[i];
       i++;
     }
   babl_fatal ("failed, aborting");
@@ -115,11 +82,11 @@ babl_fish_reference_new (Babl *source,
   Babl *babl = NULL;
   char *name = create_name (source, destination, 1);
 
-  assert (BABL_IS_BABL (source));
-  assert (BABL_IS_BABL (destination));
+  babl_assert (BABL_IS_BABL (source));
+  babl_assert (BABL_IS_BABL (destination));
 
-  assert (source->class_type == BABL_FORMAT);
-  assert (destination->class_type == BABL_FORMAT);
+  babl_assert (source->class_type == BABL_FORMAT);
+  babl_assert (destination->class_type == BABL_FORMAT);
 
   babl                   = babl_malloc (sizeof (BablFishReference) +
                                         strlen (name) + 1);
@@ -148,8 +115,8 @@ babl_fish (void *source,
   Babl *source_format      = NULL;
   Babl *destination_format = NULL;
 
-  assert (source);
-  assert (destination);
+  babl_assert (source);
+  babl_assert (destination);
 
   if (BABL_IS_BABL (source))
     {
@@ -233,7 +200,7 @@ convert_to_double (BablFormat *source_fmt,
             }
         }
 
-      babl_conversion_process (
+      babl_process (
            babl_conversion_find (src_img->type[0], dst_img->type[0]),
            src_img, dst_img,
            n);
@@ -288,7 +255,7 @@ convert_from_double (BablFormat *destination_fmt,
             }
         }
 
-      babl_conversion_process (
+      babl_process (
            babl_conversion_find (src_img->type[0], dst_img->type[0]),
            src_img, dst_img,
            n);
@@ -337,7 +304,7 @@ process_same_model (Babl      *babl,
   return 0;
 }
 
-static int
+int
 babl_fish_reference_process (Babl      *babl,
                              BablImage *source,
                              BablImage *destination,
@@ -382,7 +349,7 @@ babl_fish_reference_process (Babl      *babl,
      n
    );
 
-  babl_conversion_process (
+  babl_process (
     babl_conversion_find (
         BABL(babl->fish.source)->format.model,
         babl_model_id (BABL_RGBA)
@@ -390,7 +357,7 @@ babl_fish_reference_process (Babl      *babl,
     source_image, rgba_image,
     n);
 
-  babl_conversion_process (
+  babl_process (
     babl_conversion_find (
         babl_model_id (BABL_RGBA),
         BABL(babl->fish.destination)->format.model
@@ -416,7 +383,7 @@ babl_fish_reference_process (Babl      *babl,
   return 0;
 }
 
-static int
+int
 babl_fish_process (Babl *babl,
                    void *source,
                    void *destination,
@@ -427,52 +394,7 @@ babl_fish_process (Babl *babl,
 }
 
 
-int
-babl_process (Babl *babl,
-              void *source,
-              void *destination,
-              long  n)
-{
-  assert (babl);
-  assert (source);
-  assert (destination);
-  assert (BABL_IS_BABL (babl));
-  assert (n>0);
-
-  babl->fish.processings++;
-  babl->fish.pixels += n;
-  
-  if (babl->class_type == BABL_FISH)
-    return babl_fish_process (babl, source, destination, n);
-  
-  if (babl->class_type == BABL_FISH_REFERENCE)
-    {
-       BablImage *source_image      = NULL;
-       BablImage *destination_image = NULL;
-
-       if (BABL_IS_BABL (source))
-         source_image = source;
-       if (!source_image)
-         source_image = (BablImage*) babl_image_from_linear (
-                                        source, (Babl*)babl->fish.source);
-       if (BABL_IS_BABL (destination))
-         destination_image = destination;
-       if (!destination_image)
-         destination_image = (BablImage*) babl_image_from_linear (
-                        destination, (Babl*)babl->fish.destination);
-
-       babl_fish_reference_process (babl, source, destination, n);
-
-       babl_free (source_image);
-       babl_free (destination_image);
-
-       return 0;
-    }
-
-  babl_log ("eek");
-  return -1;
-}
 
-BABL_DEFINE_INIT    (babl_fish)
-BABL_DEFINE_DESTROY (babl_fish)
-BABL_DEFINE_EACH    (babl_fish)
+BABL_DEFINE_INIT    (fish)
+BABL_DEFINE_DESTROY (fish)
+BABL_DEFINE_EACH    (fish)
diff --git a/babl/babl-fish.h b/babl/babl-fish.h
deleted file mode 100644 (file)
index 0b15bb2..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef BABL_FISH_H
-#define BABL_FISH_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-/** create a new BablFish capable of translating between the pixel
- *  formats given in source and destination. (use babl_format (string))
- */
-Babl * babl_fish              (void *source,
-                               void *destination);
-
-/* Transform n pixels from source into destination,
- * source and destination can be pointers to linear buffers
- * (or at a later stage of babl development BablImages)
- */
-int    babl_process           (Babl *babl_fish,
-                               void *source,
-                               void *destination,
-                               int   n);
-
-/* whether the BablFish needs a BablImage to do the processing,
- * or a void pointer to a linear buffer is sufficient.
- */
-int    babl_fish_needs_image  (Babl *babl_fish);
-
-
-
-BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish)
-#endif
index b00d5a221af83a953f059b0fda9ae2296399e0eb..d09570176dac25587876638ad602043838e1ab8d 100644 (file)
@@ -21,9 +21,6 @@
 #include <stdarg.h>
 
 #include "babl-internal.h"
-#include "babl-sampling.h"
-#include "babl-type.h"
-#include "babl-component.h"
 #include "babl-db.h"
 
 static int 
@@ -259,4 +256,4 @@ babl_format_new (void *first_arg,
   }
 }
 
-BABL_CLASS_TEMPLATE (babl_format)
+BABL_CLASS_TEMPLATE (format)
diff --git a/babl/babl-format.h b/babl/babl-format.h
deleted file mode 100644 (file)
index ed3329c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_FORMAT_H
-#define _BABL_FORMAT_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-BABL_DEFINE_CLASS (babl_format)
-
-#endif
index 042b66e19b53e5cee56d65e3b9e19aaf78295fdc..853555400123af0491c0edb2d15de452cb88e12e 100644 (file)
 
 #include <string.h>
 #include <stdarg.h>
-#include <assert.h>
 
 #include "babl-internal.h"
-#include "babl-image.h"
-#include "babl-type.h"
-#include "babl-sampling.h"
-#include "babl-component.h"
-
 
 static Babl *
 image_new (BablFormat     *format,
@@ -90,9 +84,9 @@ babl_image_from_linear (void  *buffer,
   int            offset=0;
   int            calc_pitch=0;
 
-  assert (format);
-  assert (format->class_type == BABL_FORMAT ||
-          format->class_type == BABL_MODEL);
+  babl_assert (format);
+  babl_assert (format->class_type == BABL_FORMAT ||
+               format->class_type == BABL_MODEL);
  
   switch (format->class_type)
     {
diff --git a/babl/babl-image.h b/babl/babl-image.h
deleted file mode 100644 (file)
index 799be04..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_IMAGE_H
-#define _BABL_IMAGE_H
-
-#include "babl-classes.h"
-
-/* babl images are allocated as a single chunk of memory, and
- * thus can be duplicated using  duplicate = babl_dup (original);
- *
- * NB: babl_fish_process () frees the images passed in by itself.
- */
-Babl * babl_image             (void *first_component,
-                               ...);
-
-/* create a new BablImage based on a packed BablFormat (or BablModel which
- * is a virtual pixelformat based on the BablModel using only doubles in the
- * order they are listed in the model.
- */
-Babl * babl_image_from_linear (void *buffer,
-                               Babl *format);
-
-/* create a new babl image similar to the provided babl-image, but where all data
- * is in doubles,.. 
- */
-Babl * babl_image_double_from_image (Babl *source);
-
-#endif
diff --git a/babl/babl-instance.h b/babl/babl-instance.h
deleted file mode 100644 (file)
index c5bf2ad..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _BABL_INSTANCE_H
-#define _BABL_INSTANCE_H
-
-#include "babl-classes.h"
-typedef int  (*BablEachFunction) (Babl *entry,
-                                  void *data);
-
-
-/* these defines are kept here to keep the typing needed in class
- * headers to a minimum, only the ones overriding the basic api with
- * custom ways of construction.
- */
-#define BABL_DEFINE_CLASS(type_name)                      \
-                                                          \
-void   type_name##_init    (void);                        \
-void   type_name##_destroy (void);                        \
-void   type_name##_each    (BablEachFunction  each_fun,   \
-                            void             *user_data); \
-Babl * type_name           (const char       *name);      \
-Babl * type_name##_id      (int               id);        \
-Babl * type_name##_new     (void             *first_arg,  \
-                            ...);
-
-
-#define BABL_DEFINE_CLASS_NO_NEW(type_name)               \
-                                                          \
-void   type_name##_init    (void);                        \
-void   type_name##_destroy (void);                        \
-void   type_name##_each    (BablEachFunction  each_fun,   \
-                            void             *user_data); \
-Babl * type_name##_id      (int               id);
-
-#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name)         \
-                                                          \
-void   type_name##_init    (void);                        \
-void   type_name##_destroy (void);                        \
-void   type_name##_each    (BablEachFunction  each_fun,   \
-                            void             *user_data);
-
-#endif
index f19e5b717a7323196180a5bf29ede08e890843d7..9ca17e83be3ac8527d9d6f14d7be80254433a66f 100644 (file)
@@ -68,6 +68,62 @@ babl_die (void)
   exit (-1);
 }
 
+long   babl_conversion_process (Babl *conversion,
+                                void *source,
+                                void *destination,
+                                long  n);
+long
+babl_process (Babl *babl,
+              void *source,
+              void *destination,
+              long  n)
+{
+  babl_assert (babl);
+  babl_assert (source);
+  babl_assert (destination);
+  babl_assert (BABL_IS_BABL (babl));
+  babl_assert (n>0);
+
+  /* these fields are common between conversions and fishes */
+  babl->fish.processings++;
+  babl->fish.pixels += n;
+
+  /* matches all conversion classes */
+  if (babl->class_type >= BABL_CONVERSION &&
+      babl->class_type <= BABL_CONVERSION_FORMAT_PLANAR)
+    return babl_conversion_process (babl, source, destination, n);
+  
+  if (babl->class_type == BABL_FISH)
+    return babl_fish_process (babl, source, destination, n);
+  
+  if (babl->class_type == BABL_FISH_REFERENCE)
+    {
+       BablImage *source_image      = NULL;
+       BablImage *destination_image = NULL;
+
+       if (BABL_IS_BABL (source))
+         source_image = source;
+       if (!source_image)
+         source_image = (BablImage*) babl_image_from_linear (
+                                        source, (Babl*)babl->fish.source);
+       if (BABL_IS_BABL (destination))
+         destination_image = destination;
+       if (!destination_image)
+         destination_image = (BablImage*) babl_image_from_linear (
+                        destination, (Babl*)babl->fish.destination);
+
+       babl_fish_reference_process (babl, source, destination, n);
+
+       babl_free (source_image);
+       babl_free (destination_image);
+
+       return 0;
+    }
+
+  babl_log ("eek");
+  return -1;
+}
+
 void
 babl_internal_init (void)
 {
@@ -80,3 +136,10 @@ babl_internal_destroy (void)
 {
 }
 
+
+const char *
+babl_name (Babl *babl)
+{
+  babl_assert (BABL_IS_BABL (babl));
+  return babl->instance.name;
+}
index e8d31529344de21bdb5a83c9173bbdd795b7fb97..21599a3898cfa900a4a92aeaacd57c9119d7beaf 100644 (file)
 #ifndef _BABL_INTERNAL_H
 #define _BABL_INTERNAL_H
 
+#ifdef _BABL_H
+#error babl-internal.h included after babl.h
+#endif
+
 #define BABL_MAX_COMPONENTS 32
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include "assert.h"
 
 #include "babl-classes.h"
-#include "babl-instance.h"
+#undef  _BABL_INTERNAL_H
+#include "babl.h"
+#define _BABL_INTERNAL_H
+
 
 #include "babl-ids.h"
 #include "babl-util.h"
 #include "babl-memory.h"
 
-/* internal classes */
-#include "babl-introspect.h"
-#include "babl-conversion.h"
-#include "babl-extension.h"
-/* */
 
-void babl_die (void);
+int    babl_fish_process            (Babl      *babl,
+                                     void      *source,
+                                     void      *destination,
+                                     long       n);
+int    babl_fish_reference_process  (Babl      *babl,
+                                     BablImage *source,
+                                     BablImage *destination,
+                                     long       n);
+Babl * babl_image_from_linear       (void      *buffer,
+                                     Babl      *format);
+Babl * babl_image_double_from_image (Babl      *source);
+void   babl_die                     (void);
+int    babl_sanity                  (void);
+Babl * babl_extension_base          (void);
+
+Babl * babl_extender                (void);
+void   babl_set_extender            (Babl *new_extender);
+
+Babl * babl_extension_quiet_log     (void);
+
+void   babl_core_init               (void);
 
 /**** LOGGER ****/
 #include <stdarg.h>
@@ -69,25 +92,33 @@ real_babl_log (const char *file,
   fprintf (stdout, "\n");
 }
 
-#define babl_log(args...)  real_babl_log(__FILE__, __LINE__, __FUNCTION__, args)
+#define babl_log(args...)                               \
+  real_babl_log(__FILE__, __LINE__, __FUNCTION__, args)
 
-#define babl_fatal(args...)  \
-  do{ \
-    real_babl_log(__FILE__, __LINE__, __FUNCTION__, args);\
-    babl_die();} \
-  while(0);
+#define babl_fatal(args...) do{                         \
+  real_babl_log(__FILE__, __LINE__, __FUNCTION__, args);\
+  babl_die();}                                          \
+while(0)
 
 
-/********************/
+#define babl_assert(expr) do{ \
+  if(!(expr))                 \
+    {                         \
+      babl_fatal("Eeeeek");   \
+      assert(expr);           \
+    }                         \
+}while(0)
+/***** LOGGER (end)**/
 
-#define BABL_CLASS_TYPE_IS_VALID(klass_type) \
+#define BABL_CLASS_TYPE_IS_VALID(klass_type)                            \
     (  ((klass_type)>=BABL_INSTANCE ) && ((klass_type)<=BABL_SKY) ?1:0 )
 
-#define BABL_IS_BABL(obj)                              \
-(NULL==(obj)?0:                                        \
- BABL_CLASS_TYPE_IS_VALID(((Babl*)(obj))->class_type)  \
+#define BABL_IS_BABL(obj)                                          \
+(NULL==(obj)?0                                                     \
           :BABL_CLASS_TYPE_IS_VALID(((Babl*)(obj))->class_type)  \
 )
 
+
 extern int   babl_hmpf_on_name_lookups;
 
 const char  *babl_class_name     (BablClassType klass);
@@ -97,7 +128,7 @@ void         babl_internal_destroy (void);
 
 #define BABL_DEFINE_EACH(type_name)                           \
 void                                                          \
-type_name##_each (BablEachFunction  each_fun,                 \
+babl_##type_name##_each (BablEachFunction  each_fun,          \
                   void             *user_data)                \
 {                                                             \
   db_each (each_fun, user_data);                              \
@@ -105,7 +136,7 @@ type_name##_each (BablEachFunction  each_fun,                 \
 
 #define BABL_DEFINE_LOOKUP_BY_ID(type_name)                   \
 Babl *                                                        \
-type_name##_id (int id)                                       \
+babl_##type_name##_id (int id)                                \
 {                                                             \
   Babl *babl;                                                 \
   babl = db_exist (id, NULL);                                 \
@@ -118,7 +149,7 @@ type_name##_id (int id)                                       \
 
 #define BABL_DEFINE_LOOKUP_BY_NAME(type_name)                   \
 Babl *                                                          \
-type_name (const char *name)                                    \
+babl_##type_name (const char *name)                             \
 {                                                               \
   Babl *babl;                                                   \
                                                                 \
@@ -150,7 +181,7 @@ type_name (const char *name)                                    \
 
 #define BABL_DEFINE_INIT(type_name)                           \
 void                                                          \
-type_name##_init (void)                                       \
+babl_##type_name##_init (void)                                \
 {                                                             \
   BABL_PRE_INIT_HOOK;                                         \
   db_init ();                                                 \
@@ -159,10 +190,10 @@ type_name##_init (void)                                       \
 
 #define BABL_DEFINE_DESTROY(type_name)                        \
 void                                                          \
-type_name##_destroy (void)                                    \
+babl_##type_name##_destroy (void)                             \
 {                                                             \
   BABL_DESTROY_PRE_HOOK;                                      \
-  db_each (each_##type_name##_destroy, NULL);                 \
+  db_each (each_babl_##type_name##_destroy, NULL);            \
   db_destroy ();                                              \
   BABL_DESTROY_HOOK;                                          \
 }
index fb2d0f697446eab467c249f15002c6c5cfb20500..12b4ffd107da8b4617516506bbc838ee50ac80e0 100644 (file)
@@ -17,7 +17,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
 #include "babl-internal.h"    /* for babl_log */
 
 #define BABL_LOG
diff --git a/babl/babl-introspect.h b/babl/babl-introspect.h
deleted file mode 100644 (file)
index e9f580c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_INTROSPECT_H
-#define _BABL_INTROSPECT_H
-
-#include "babl-classes.h"
-
-void
-babl_introspect (Babl *babl);
-
-#endif
index 811414ec27cb7b7d3fc761f0f815a5a159f082c8..13e518c58f1086726f7d645c8fdd268c43a75ec6 100644 (file)
@@ -17,7 +17,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -98,12 +97,12 @@ babl_malloc (size_t size)
 {
   void *ret;
 
-  assert (size);
+  babl_assert (size);
 
   functions_sanity ();
   ret = malloc_f (size + OFFSET);
   if (!ret)
-    babl_log ("args=(%i): failed",  size);
+    babl_fatal ("args=(%i): failed",  size);
 
   BAI(ret + OFFSET)->signature = signature;
   BAI(ret + OFFSET)->size      = size;
@@ -120,7 +119,7 @@ babl_dup (void *ptr)
 {
   void *ret;
  
-  assert (IS_BAI (ptr));
+  babl_assert (IS_BAI (ptr));
 
   ret = babl_malloc (BAI(ptr)->size);
   memcpy (ret, ptr, BAI(ptr)->size);
@@ -159,7 +158,7 @@ babl_realloc (void   *ptr,
       return babl_malloc (size);
     }
 
-  assert (IS_BAI (ptr));
+  babl_assert (IS_BAI (ptr));
 
   if (size==0)
     {
@@ -207,7 +206,7 @@ babl_calloc (size_t nmemb,
 size_t
 babl_sizeof (void *ptr)
 {
-  assert (IS_BAI (ptr));
+  babl_assert (IS_BAI (ptr));
   return BAI(ptr)->size;
 }
 
@@ -250,7 +249,7 @@ babl_strcat (char       *dest,
       strcpy (ret, src);
       return ret;
     }
-  assert (IS_BAI (dest));
+  babl_assert (IS_BAI (dest));
   dst_len = strlen (dest);
   
   ret = dest;
index d42a8b11e3916bcc1c897fd621dfd4df9d9fcefc..a876cc2da7dce222852f5c50b58ee18717b3bf38 100644 (file)
@@ -168,4 +168,4 @@ babl_model_new (void *first_argument,
   }
 }
 
-BABL_CLASS_TEMPLATE (babl_model)
+BABL_CLASS_TEMPLATE (model)
diff --git a/babl/babl-model.h b/babl/babl-model.h
deleted file mode 100644 (file)
index 3a19b02..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_format_H
-#define _BABL_format_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-BABL_DEFINE_CLASS (babl_model)
-
-#endif
index 7a51d5197bf76cf171f8a9ace5f69feae30ea652..8d786dbbb855db17c97a1db706ae301feb9120db 100644 (file)
@@ -27,7 +27,7 @@
 static BablSampling db[(HORIZONTAL_MAX-HORIZONTAL_MIN+1)*
                        (VERTICAL_MAX-VERTICAL_MIN+1)];
 
-BablSampling *
+Babl *
 babl_sampling (int horizontal,
                int vertical)
 {
@@ -35,7 +35,7 @@ babl_sampling (int horizontal,
       vertical<=4 &&
       horizontal>=1 &&
       horizontal<=4)
-    return &db [ (vertical-1) * 4 + (horizontal-1)];
+    return (Babl*)&db [ (vertical-1) * 4 + (horizontal-1)];
   else
     babl_log ("babl_samping(%i,%i): arguments out of bounds",
               horizontal, vertical);
diff --git a/babl/babl-sampling.h b/babl/babl-sampling.h
deleted file mode 100644 (file)
index cdedccc..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_SAMPLING_H
-#define _BABL_SAMPLING_H
-
-#include "babl-classes.h"
-#include "babl-instance.h"
-
-Babl * babl_sampling (int horizontal,
-                      int vertical);
-
-BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_sampling)
-#endif
index d68b84818fefbfa04f58fbfe0c4e234d161812b8..bb84b0c8ce4cba4b42bb54213e22b21cf971260d 100644 (file)
@@ -17,7 +17,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
 #include "babl-internal.h"
 
 static int OK;
diff --git a/babl/babl-sanity.h b/babl/babl-sanity.h
deleted file mode 100644 (file)
index 18c978c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_SANITY_H
-#define _BABL_SANITY_H
-
-int babl_sanity (void);
-
-#endif
index 6ea73a4f686e580f9b32e1a10156132f25c90052..49534cc9faf2c92ae9096797fcc0f90704db1575 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <string.h>
 #include <stdarg.h>
-#include <assert.h>
 
 #include "babl-internal.h"
 #include "babl-db.h"
@@ -43,8 +42,8 @@ type_new (const char  *name,
 {
   Babl *babl;
 
-  assert (bits != 0);
-  assert (bits % 8 == 0);
+  babl_assert (bits != 0);
+  babl_assert (bits % 8 == 0);
   
   babl                = babl_malloc (sizeof (BablType) + strlen (name) + 1);
   babl->instance.name = (void*) babl + sizeof (BablType);
@@ -59,7 +58,7 @@ type_new (const char  *name,
 }
 
 Babl *
-babl_type_new (const char *name,
+babl_type_new (void *first_arg,
                ...)
 {
   va_list  varg;
@@ -72,9 +71,9 @@ babl_type_new (const char *name,
   double   min_val    = 0.0;
   double   max_val    = 0.0;
 
-  const char *arg=name;
+  const char *arg=first_arg;
 
-  va_start (varg, name);
+  va_start (varg, first_arg);
   
   while (1)
     {
@@ -125,13 +124,13 @@ babl_type_new (const char *name,
       
       else
         {
-          babl_fatal ("unhandled argument '%s' for format '%s'", arg, name);
+          babl_fatal ("unhandled argument '%s' for format '%s'", arg, first_arg);
         }
     }
     
   va_end   (varg);
 
-  babl = type_new (name, id, bits);
+  babl = type_new (first_arg, id, bits);
 
   { 
     Babl *ret = db_insert (babl);
@@ -141,4 +140,4 @@ babl_type_new (const char *name,
   }
 }
 
-BABL_CLASS_TEMPLATE (babl_type)
+BABL_CLASS_TEMPLATE (type)
diff --git a/babl/babl-type.h b/babl/babl-type.h
deleted file mode 100644 (file)
index f4417e3..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _BABL_TYPE_H
-#define _BABL_TYPE_H
-
-#include "babl-classes.h"
-BABL_DEFINE_CLASS (babl_type)
-
-#endif
index 3d0dd1d0f2d04d120c9d13425a220aff44af30ad..1388442bf04d83cb0aabb68c240b63d9bc856b42 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
 #include "babl-internal.h"
-#include "babl-sanity.h"
-#include "babl-introspect.h"
-#include "babl-core.h"
 
 static int ref_count=0;
 
index 88249d60e2567c99da487bf2eb6ff391cb240123..b178456c36a2a0fbc047f32d2d55c24e92284f92 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+/* NOTE! the babl API is polymorphic, it is probably easier to learn
+ * it's usage by studying examples than this header file. The public
+ * functions are attempted explained anyways.
+ */
+
 #ifndef _BABL_H
 #define _BABL_H
 
-#if __GNUC__ >=4
-   #define BABL_NULL_TERMINATED __attribute_((__sentinel__))
-#else
-   #define BABL_NULL_TERMINATED
+#ifdef _BABL_INTERNAL_H
+#error babl.h included after babl-internal.h
+#endif
+#ifndef _BABL_CLASSES_H
+#define Babl  void
 #endif
 
+/** Initialize the babl library */
+void   babl_init       (void);
+
+/** Deinitialize the babl library (frees any resources used, if the number
+ *  of calls to babl_destroy() is is equal to the number of calls to
+ *  babl_init()
+ */
+void   babl_destroy    (void);
+
+
+#define BABL_CLASS_NO_NAME(type_name)                            \
+                                                                 \
+void   babl_##type_name##_init    (void);                        \
+void   babl_##type_name##_destroy (void);                        \
+Babl * babl_##type_name##_id      (int id);                      \
+void   babl_##type_name##_each    (BablEachFunction  each_fun,   \
+                                   void             *user_data);
+
+#define BABL_CLASS(type_name)                                    \
+                                                                 \
+BABL_CLASS_NO_NAME (type_name)                                   \
+Babl * babl_##type_name           (const char       *name);      \
+Babl * babl_##type_name##_new     (void             *first_arg,  \
+                                   ...);
+
+typedef int  (*BablEachFunction) (Babl *entry,
+                                  void *data);
+
+
+/****************************************************************/
+/* BablFish */                           BABL_CLASS_NO_NAME (fish)
+/*  Create a babl fish capable of converting from source_format to
+ *  destination_format, source and destination can be
+ *  either strings with the names of the formats or BablFormat objects.
+ */
+Babl * babl_fish       (void *source_format,
+                        void *destination_format);
+
+/** Process n pixels from source to destination using babl_fish,
+ *  returns number of pixels converted. 
+ */
+long   babl_process    (Babl *babl_fish,
+                        void *source,
+                        void *destination,
+                        long  n);
+
+/****************************************************************/
+/* BablImage */                         BABL_CLASS_NO_NAME (image)
+/*
+ * Babl images can be used for planar buffers instead of linear buffers for
+ * babl_process(), BablImages are still experimental, for now BablImages can be
+ * passed to babl_process, two different babl_process() functions will be
+ * needed for this since the polymorphism cannot be trusted to work on linear
+ * buffers.
+ * 
+ * Babl * babl_image (BablComponent *component1,
+ *                    void          *data,
+ *                    int            pitch,
+ *                    int            stride,
+ *                   [BablComponent *component1,
+ *                    void          *data,
+ *                    int            pitch,
+ *                    int            stride,
+ *                    ...]
+ *                    NULL);
+ */
+Babl * babl_image      (void *first_component,
+                        ...);
+
+
+
+/****************************************************************/
+/* BablType */                                   BABL_CLASS (type)
+/*
+ * A data type that babl can have in it's buffers, requires
+ * conversions to and from "double" to be registered before
+ * passing sanity.
+ * 
+ * Babl * babl_type_new (  const char *name,
+ *                         "bits",     int bits,
+ *                         ["min_val", double min_val,] 
+ *                         ["max_val", double max_val,] 
+ *                         NULL);
+ */  
+
+
+/****************************************************************/
+/* BablComponent */                         BABL_CLASS (component)
+/*
+ * Babl * babl_component_new (const char *name,
+ *                            NULL);
+ */  
+
+
+/****************************************************************/
+/* BablModel */                                 BABL_CLASS (model)
+/*
+ * Babl * babl_model_new (["name", const char *name,]
+ *                        BablComponent *component1,
+ *                       [BablComponent *componentN, ...]
+ *                        NULL);
+ *
+ * If no name is provided a name is generated by concatenating the
+ * name of all the involved components.
+ *
+ */  
+
+/****************************************************************/
+/* BablSampling */                   BABL_CLASS_NO_NAME (sampling)
+/**/
+Babl * babl_sampling   (int horizontal,
+                        int vertical);
+
+/****************************************************************/
+/* BablFormat */                               BABL_CLASS (format)
+/*
+ * Babl * babl_format_new (["name", const char *name,]
+ *                          BablModel          *model,
+ *                         [BablType           *type,]
+ *                         [BablSampling,      *sampling,]
+ *                          BablComponent      *component1,
+ *                        [[BablType           *type,]
+ *                         [BablSampling       *sampling,]
+ *                          BablComponent      *componentN,
+ *                        ...]
+ *                          ["planar",]
+ *                          NULL);
+ *
+ * Provided BablType and|or BablSampling is valid for the following
+ * components as well. If no name is provided a (long) descriptive
+ * name is used.
+ */  
+
+
+/****************************************************************/
+/* BablExtension */                         BABL_CLASS (extension)
+/*
+ * BablExtension objects are only used internally in babl.
+ */
+
+/****************************************************************/
+/* BablConversion */                       BABL_CLASS (conversion)
+/*
+ * Babl * babl_conversion_new (<BablFormat *source, BablFormat *destination|
+ *                              BablModel  *source, BablModel  *destination|
+ *                              BablType   *source, BablType   *destination>,
+ *                             <"linear"|"planar">, BablConversionFunc conv_func,
+ *                              NULL);
+ */  
+
+
+const char *babl_name (Babl *babl);  /* returns the name of a babl object */
+void   babl_introspect (Babl *babl); /* introspect a given BablObject     */
+
+#undef BABL_CLASS
 #include <stdlib.h>
-#include "babl-classes.h"
-#include "babl-component.h"
-#include "babl-conversion.h"
-#include "babl-fish.h"
-#include "babl-image.h"
-#include "babl-model.h"
-#include "babl-format.h"
-#include "babl-type.h"
-#include "babl-sampling.h"
-
-void babl_init       (void);
-void babl_destroy    (void);
 
 #endif
index 219d6cabf55fc576d20e52615f304eaa9e13b7ac..85df0685cc4040db425df63edb095285c332bdb1 100644 (file)
@@ -95,14 +95,14 @@ models (void)
   );
 }
 
-static void
+static long
 rgb_to_cmyk (int    src_bands,
              void **src,
              int   *src_pitch,
              int    dst_bands,
              void **dst,
              int   *dst_pitch,
-             int    n)
+             long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -150,16 +150,17 @@ rgb_to_cmyk (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long 
 cmyk_to_rgb (int    src_bands,
              void **src,
              int   *src_pitch,
              int    dst_bands,
              void **dst,
              int   *dst_pitch,
-             int    n)
+             long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -196,17 +197,18 @@ cmyk_to_rgb (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 #if 0
-static void
+static long
 rgb_to_and_from_cmy (int    src_bands,
                      void **src,
                      int   *src_pitch,
                      int    dst_bands,
                      void **dst,
                      int   *dst_pitch,
-                     int    n)
+                     long   n)
 {
   BABL_PLANAR_SANITY
 
index b494dea9930194b0f0e179fae4917db08d3a6f37..979f3b71d41e5dffa5be47ea7e30c48eef6bbbb7 100644 (file)
@@ -91,14 +91,14 @@ models (void)
 }
 
 
-static void
+static long
 rgb_to_gray (int    src_bands,
              void **src,
              int   *src_pitch,
              int    dst_bands,
              void **dst,
              int   *dst_pitch,
-             int    n)
+             long   n)
 {
   BABL_PLANAR_SANITY
   while (n--)
@@ -124,17 +124,18 @@ rgb_to_gray (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 
-static void
+static long
 rgb_to_gray_2_2 (int    src_bands,
                  void **src,
                  int   *src_pitch,
                  int    dst_bands,
                  void **dst,
                  int   *dst_pitch,
-                 int    n)
+                 long   n)
 {
   BABL_PLANAR_SANITY
   while (n--)
@@ -160,17 +161,18 @@ rgb_to_gray_2_2 (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 
-static void
+static long
 gray_2_2_to_rgb (int    src_bands,
                  void **src,
                  int   *src_pitch,
                  int    dst_bands,
                  void **dst,
                  int   *dst_pitch,
-                 int    n)
+                 long   n)
 {
   BABL_PLANAR_SANITY
   while (n--)
@@ -197,18 +199,19 @@ gray_2_2_to_rgb (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 
 
-static void
+static long
 gray_to_rgb (int    src_bands,
              void **src,
              int   *src_pitch,
              int    dst_bands,
              void **dst,
              int   *dst_pitch,
-             int    n)
+             long   n)
 {
   BABL_PLANAR_SANITY
   while (n--)
@@ -235,16 +238,17 @@ gray_to_rgb (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 gray_alpha_premultiplied_to_rgba (int    src_bands,
                                   void **src,
                                   int   *src_pitch,
                                   int    dst_bands,
                                   void **dst,
                                   int   *dst_pitch,
-                                  int    n)
+                                  long   n)
 {
   BABL_PLANAR_SANITY
   assert (src_bands == 2);
@@ -270,17 +274,18 @@ gray_alpha_premultiplied_to_rgba (int    src_bands,
       *(double*)dst[3] = alpha;
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 
-static void
+static long
 rgba_to_gray_alpha_premultiplied (int    src_bands,
                                   void **src,
                                   int   *src_pitch,
                                   int    dst_bands,
                                   void **dst,
                                   int   *dst_pitch,
-                                  int    n)
+                                  long   n)
 {
   BABL_PLANAR_SANITY;
   assert (src_bands == 4);
@@ -304,16 +309,17 @@ rgba_to_gray_alpha_premultiplied (int    src_bands,
       *(double*)dst[1] = alpha;
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 non_premultiplied_to_premultiplied (int    src_bands,
                                     void **src,
                                     int   *src_pitch,
                                     int    dst_bands,
                                     void **dst,
                                     int   *dst_pitch,
-                                    int    n)
+                                    long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -331,16 +337,17 @@ non_premultiplied_to_premultiplied (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 premultiplied_to_non_premultiplied (int    src_bands,
                                     void **src,
                                     int   *src_pitch,
                                     int    dst_bands,
                                     void **dst,
                                     int   *dst_pitch,
-                                    int    n)
+                                    long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -365,6 +372,7 @@ premultiplied_to_non_premultiplied (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 static void
index aff0c28ea6a4855d0398c432f42731518c714ed2..0bf9c06fd668b1d918e89b09378721092fd252a5 100644 (file)
@@ -121,14 +121,14 @@ models (void)
     NULL);
 }
 
-static void
+static long
 copy_strip_1 (int    src_bands,
               void **src,
               int   *src_pitch,
               int    dst_bands,
               void **dst,
               int   *dst_pitch,
-              int    n)
+              long   n)
 {
   BABL_PLANAR_SANITY
   while (n--)
@@ -147,16 +147,17 @@ copy_strip_1 (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 g3_gamma_2_2 (int    src_bands,
               void **src,
               int   *src_pitch,
               int    dst_bands,
               void **dst,
               int   *dst_pitch,
-              int    n)
+              long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -170,17 +171,18 @@ g3_gamma_2_2 (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 
-static void
+static long
 g3_inv_gamma_2_2 (int    src_bands,
                   void **src,
                   int   *src_pitch,
                   int    dst_bands,
                   void **dst,
                   int   *dst_pitch,
-                  int    n)
+                  long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -200,16 +202,17 @@ g3_inv_gamma_2_2 (int    src_bands,
         }
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 non_premultiplied_to_premultiplied (int    src_bands,
                                     void **src,
                                     int   *src_pitch,
                                     int    dst_bands,
                                     void **dst,
                                     int   *dst_pitch,
-                                    int    n)
+                                    long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -227,16 +230,17 @@ non_premultiplied_to_premultiplied (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 premultiplied_to_non_premultiplied (int    src_bands,
                                     void **src,
                                     int   *src_pitch,
                                     int    dst_bands,
                                     void **dst,
                                     int   *dst_pitch,
-                                    int    n)
+                                    long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -261,6 +265,7 @@ premultiplied_to_non_premultiplied (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 static void
index 2d810785fd8ba6f30887ff79895fa5844aca20df..f03cf76f8727b94ef5e2deed83543051d3448c86 100644 (file)
@@ -74,14 +74,14 @@ models (void)
     NULL);
 }
 
-static void
+static long
 rgb_to_ycbcr (int    src_bands,
               void **src,
               int   *src_pitch,
               int    dst_bands,
               void **dst,
               int   *dst_pitch,
-              int    n)
+              long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -110,16 +110,17 @@ rgb_to_ycbcr (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 ycbcr_to_rgb (int    src_bands,
               void **src,
               int   *src_pitch,
               int    dst_bands,
               void **dst,
               int   *dst_pitch,
-              int    n)
+              long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -148,6 +149,7 @@ ycbcr_to_rgb (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 static void
index 10576f8587bb4a2367e840dd7a864f5412d1158a..0f23f229638f93a59f075c4e5f3b8ec55002efed 100644 (file)
 #include "babl.h"
 #include "babl-ids.h"
 
-static void
+static long
 convert_double_float (void *src,
                       void *dst,
                       int   src_pitch,
                       int   dst_pitch,
-                      int   n)
+                      long  n)
 {
   while (n--)
     {
@@ -36,14 +36,15 @@ convert_double_float (void *src,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
-static void
+static long
 convert_float_double (void *src,
                       void *dst,
                       int   src_pitch,
                       int   dst_pitch,
-                      int   n)
+                      long  n)
 {
   while (n--)
     {
@@ -51,6 +52,7 @@ convert_float_double (void *src,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
 void
index e26f4759731baa9ce61dc565be0b6b1ea5f31c0f..170b357c66bffaf965caebd1de958c5567411979 100644 (file)
@@ -24,7 +24,7 @@
 #include "babl-ids.h"
 
 
-static inline void
+static inline long
 convert_double_u16_scaled (double         min_val,
                            double         max_val,
                            unsigned short min,
@@ -33,7 +33,7 @@ convert_double_u16_scaled (double         min_val,
                            void          *dst,
                            int            src_pitch,
                            int            dst_pitch,
-                           int            n)
+                           long           n)
 {
   while (n--)
     {
@@ -51,9 +51,10 @@ convert_double_u16_scaled (double         min_val,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
-static inline void
+static inline long
 convert_u16_double_scaled (double         min_val,
                            double         max_val,
                            unsigned short min,
@@ -62,7 +63,7 @@ convert_u16_double_scaled (double         min_val,
                            void          *dst,
                            int            src_pitch,
                            int            dst_pitch,
-                           int            n)
+                           long           n)
 {
   while (n--)
     {
@@ -80,27 +81,28 @@ convert_u16_double_scaled (double         min_val,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
 #define MAKE_CONVERSIONS(name, min_val, max_val, min, max)      \
-static void                                                     \
+static long                                                     \
 convert_##name##_double (void *src,                             \
                          void *dst,                             \
                          int   src_pitch,                       \
                          int   dst_pitch,                       \
-                         int   n)                               \
+                         long  n)                               \
 {                                                               \
-  convert_u16_double_scaled (min_val, max_val, min, max,        \
+  return convert_u16_double_scaled (min_val, max_val, min, max, \
                              src, dst, src_pitch, dst_pitch, n);\
 }                                                               \
-static void                                                     \
+static long                                                     \
 convert_double_##name (void *src,                               \
                        void *dst,                               \
                        int   src_pitch,                         \
                        int   dst_pitch,                         \
-                       int   n)                                 \
+                       long  n)                                 \
 {                                                               \
-  convert_double_u16_scaled (min_val, max_val, min, max,        \
+  return convert_double_u16_scaled (min_val, max_val, min, max, \
                              src, dst, src_pitch, dst_pitch, n);\
 }
 
index 99a4af62ac1c03897847e9bde6b6eddc9d8feabd..f802fa96511bff0757f2a88e12d36ca3ab591702 100644 (file)
@@ -23,7 +23,7 @@
 #include "babl.h"
 #include "babl-ids.h"
 
-static inline void
+static inline long
 convert_double_u8_scaled (double        min_val,
                           double        max_val,
                           unsigned char min,
@@ -32,7 +32,7 @@ convert_double_u8_scaled (double        min_val,
                           void         *dst,
                           int           src_pitch,
                           int           dst_pitch,
-                          int           n)
+                          long          n)
 {
   while (n--)
     {
@@ -50,9 +50,10 @@ convert_double_u8_scaled (double        min_val,
       src += src_pitch;
       dst += dst_pitch;
     }
+  return n;
 }
 
-static inline void
+static inline long
 convert_u8_double_scaled (double        min_val,
                           double        max_val,
                           unsigned char min,
@@ -61,7 +62,7 @@ convert_u8_double_scaled (double        min_val,
                           void         *dst,
                           int           src_pitch,
                           int           dst_pitch,
-                          int           n)
+                          long          n)
 {
   while (n--)
     {
@@ -80,27 +81,28 @@ convert_u8_double_scaled (double        min_val,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
 #define MAKE_CONVERSIONS(name, min_val, max_val, min, max)      \
-static void                                                     \
+static long                                                     \
 convert_##name##_double (void *src,                             \
                          void *dst,                             \
                          int   src_pitch,                       \
                          int   dst_pitch,                       \
-                         int   n)                               \
+                         long  n)                               \
 {                                                               \
-  convert_u8_double_scaled (min_val, max_val, min, max,         \
+  return convert_u8_double_scaled (min_val, max_val, min, max,  \
                             src, dst, src_pitch, dst_pitch, n); \
 }                                                               \
-static void                                                     \
+static long                                                     \
 convert_double_##name (void *src,                               \
                        void *dst,                               \
                        int   src_pitch,                         \
                        int   dst_pitch,                         \
-                       int   n)                                 \
+                       long  n)                                 \
 {                                                               \
-  convert_double_u8_scaled (min_val, max_val, min, max,         \
+  return convert_double_u8_scaled (min_val, max_val, min, max,  \
                             src, dst, src_pitch, dst_pitch, n); \
 }
 
index 1f65435ca6f55045c366f53d9cb1a2f5f42ed756..a1a0e6fa3178cf0c614efd11010cace60714abb2 100644 (file)
@@ -62,6 +62,7 @@
         <a name='NEWS'></a>
         <h2>News</h2>
 <!--NEWS-->
+        <p>Also see the <a href='http://cvs.gnome.org/viewcvs/babl/ChangeLog'>CVS ChangeLog</a>.</p>
 
         <a name='Features'></a>
         <h2>Features</h2>
@@ -73,7 +74,7 @@
           <li class='stable'>Planar and linear buffers</li>
           <li class='stable'>Thread safety for processing.</li>
 
-          <li class='unstable'>Extension and introspection of formats,
+          <li class='unstable'>Extension and <a href='http://pippin.gimp.org/babl/introspect.txt'>introspection</a> of formats,
           color models, components and datatypes</li>
           <li class='unstable'>Horizontal an vertical subsampling (for
           implementing 4:2:2 4:2:0 4:1:1 etc. chroma subsampling)</li>
index 0f321bd2fbc85102c04df37b5343a33044ea2fa6..dd90b76ed38a82c54eac9dbaa939c67a73d5d078 100644 (file)
@@ -142,14 +142,14 @@ cpercep_distance_space (const double L1, const double a1, const double b1,
 
 
 
-static void
+static long
 rgb_to_lab (int    src_bands,
             void **src,
             int   *src_pitch,
             int    dst_bands,
             void **dst,
             int   *dst_pitch,
-            int    n)
+            long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -172,16 +172,17 @@ rgb_to_lab (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 lab_to_rgb (int    src_bands,
             void **src,
             int   *src_pitch,
             int    dst_bands,
             void **dst,
             int   *dst_pitch,
-            int    n)
+            long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -204,6 +205,7 @@ lab_to_rgb (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
 static void
@@ -289,7 +291,7 @@ formats (void)
 }
 
 
-static inline void
+static inline long
 convert_double_u8_scaled (double        min_val,
                           double        max_val,
                           unsigned char min,
@@ -298,7 +300,7 @@ convert_double_u8_scaled (double        min_val,
                           void         *dst,
                           int           src_pitch,
                           int           dst_pitch,
-                          int           n)
+                          long          n)
 {
   while (n--)
     {
@@ -316,9 +318,10 @@ convert_double_u8_scaled (double        min_val,
       src += src_pitch;
       dst += dst_pitch;
     }
+  return n;
 }
 
-static inline void
+static inline long
 convert_u8_double_scaled (double        min_val,
                           double        max_val,
                           unsigned char min,
@@ -327,7 +330,7 @@ convert_u8_double_scaled (double        min_val,
                           void         *dst,
                           int           src_pitch,
                           int           dst_pitch,
-                          int           n)
+                          long          n)
 {
   while (n--)
     {
@@ -346,27 +349,28 @@ convert_u8_double_scaled (double        min_val,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
 #define MAKE_CONVERSIONS(name, min_val, max_val, min, max)      \
-static void                                                     \
+static long                                                     \
 convert_##name##_double (void *src,                             \
                          void *dst,                             \
                          int   src_pitch,                       \
                          int   dst_pitch,                       \
-                         int   n)                               \
+                         long  n)                               \
 {                                                               \
-  convert_u8_double_scaled (min_val, max_val, min, max,         \
+  return convert_u8_double_scaled (min_val, max_val, min, max,  \
                             src, dst, src_pitch, dst_pitch, n); \
 }                                                               \
-static void                                                     \
+static long                                                     \
 convert_double_##name (void *src,                               \
                        void *dst,                               \
                        int   src_pitch,                         \
                        int   dst_pitch,                         \
-                       int   n)                                 \
+                       long  n)                                 \
 {                                                               \
-  convert_double_u8_scaled (min_val, max_val, min, max,         \
+  return convert_double_u8_scaled (min_val, max_val, min, max,  \
                             src, dst, src_pitch, dst_pitch, n); \
 }
 
@@ -427,7 +431,7 @@ types_u8 (void)
   );
 }
 
-static inline void
+static inline long
 convert_double_u16_scaled (double         min_val,
                            double         max_val,
                            unsigned short min,
@@ -436,7 +440,7 @@ convert_double_u16_scaled (double         min_val,
                            void          *dst,
                            int            src_pitch,
                            int            dst_pitch,
-                           int            n)
+                           long           n)
 {
   while (n--)
     {
@@ -454,9 +458,10 @@ convert_double_u16_scaled (double         min_val,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
-static inline void
+static inline long
 convert_u16_double_scaled (double         min_val,
                            double         max_val,
                            unsigned short min,
@@ -465,7 +470,7 @@ convert_u16_double_scaled (double         min_val,
                            void          *dst,
                            int            src_pitch,
                            int            dst_pitch,
-                           int            n)
+                           long           n)
 {
   while (n--)
     {
@@ -483,27 +488,28 @@ convert_u16_double_scaled (double         min_val,
       dst += dst_pitch;
       src += src_pitch;
     }
+  return n;
 }
 
 #define MAKE_CONVERSIONS(name, min_val, max_val, min, max)      \
-static void                                                     \
+static long                                                     \
 convert_##name##_double (void *src,                             \
                          void *dst,                             \
                          int   src_pitch,                       \
                          int   dst_pitch,                       \
-                         int   n)                               \
+                         long  n)                               \
 {                                                               \
-  convert_u16_double_scaled (min_val, max_val, min, max,        \
+  return convert_u16_double_scaled (min_val, max_val, min, max, \
                              src, dst, src_pitch, dst_pitch, n);\
 }                                                               \
-static void                                                     \
+static long                                                     \
 convert_double_##name (void *src,                               \
                        void *dst,                               \
                        int   src_pitch,                         \
                        int   dst_pitch,                         \
-                       int   n)                                 \
+                       long  n)                                 \
 {                                                               \
-  convert_double_u16_scaled (min_val, max_val, min, max,        \
+  return convert_double_u16_scaled (min_val, max_val, min, max, \
                              src, dst, src_pitch, dst_pitch, n);\
 }
 
index 2eb39e61a90f352cfa7acf5779d989fe9fbbcde7..7badb0df20431af630471c5f44c9f2bc2a131b24 100644 (file)
 #include "babl.h"
 #include "util.h"
 
-static void rgb_to_cmyk (int    src_bands,
+static long rgb_to_cmyk (int    src_bands,
                          void **src,
                          int   *src_pitch,
                          int    dst_bands,
                          void **dst,
                          int   *dst_pitch,
-                         int    n);
-static void cmyk_to_rgb (int    src_bands,
+                         long   n);
+static long cmyk_to_rgb (int    src_bands,
                          void **src,
                          int   *src_pitch,
                          int    dst_bands,
                          void **dst,
                          int   *dst_pitch,
-                         int    n);
+                         long   n);
 int
 init (void)
 {
@@ -108,14 +108,14 @@ init (void)
   return 0;
 }
 
-static void
+static long
 rgb_to_cmyk (int    src_bands,
              void **src,
              int   *src_pitch,
              int    dst_bands,
              void **dst,
              int   *dst_pitch,
-             int    n)
+             long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -163,16 +163,17 @@ rgb_to_cmyk (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
-static void
+static long
 cmyk_to_rgb (int    src_bands,
              void **src,
              int   *src_pitch,
              int    dst_bands,
              void **dst,
              int   *dst_pitch,
-             int    n)
+             long   n)
 {
   BABL_PLANAR_SANITY
 
@@ -209,5 +210,6 @@ cmyk_to_rgb (int    src_bands,
 
       BABL_PLANAR_STEP
     }
+  return n;
 }
 
index e26e5a7b50aa4ae6c0dafcb5c7ec961f695c6937..d33aab599c9acf2a26c4670f38948a228e480aa7 100644 (file)
@@ -17,8 +17,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
-#include "babl-internal.h"    /* for babl_log */
+#include "babl-internal.h"    /* needed for babl_log */
 
 static void model_html              (Babl *babl);
 static void type_html               (Babl *babl);
index c01115073492b33fde2054e221d5a9ebdd9d9fb2..2b0a6a3c238745af914c6202d3e04e5e5ae2489c 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <string.h>
 #include <stdio.h>
-#include "babl.h"
 #include "babl-internal.h"
 
 struct
index cc2c48ea517745f4a4ffae5637c8dd2512544a9a..b3d06f22a270720cb52f7ff7dd3a69bed0c69c2c 100644 (file)
@@ -17,7 +17,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
 #include "babl-internal.h"
 
 #define PIXELS 5
index 84ff384e9b85adee755d7fcd47cb55e1cc47a627..26cbec97240c901315094be5fcddab6afd9836ed 100644 (file)
@@ -17,7 +17,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
 #include "babl-internal.h"
 
 int
index 557d68078c67396dbd371703ec46daa00f41b555..9faf564f18c2f7d174f72927653af673c283d137 100644 (file)
@@ -2,8 +2,7 @@
  * RGBA data */
 
 #include <stdlib.h>
-#include "babl.h"
-#include "math.h"
+#include <math.h>
 #include "babl-internal.h"
 
 int OK=1;
index bdf6fdefaf49b21c1efbba74cd15198f44de749c..ecc44a6afd16654aa8b2b9f632735180e862659c 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "babl.h"
-#include "babl-internal.h"
 
 int
 main (int    argc,
index 2f0d395cd9ce372622f5a7952d76b77c28624966..e424642c2acd7612503d44ad2c45bc8d71831362 100644 (file)
@@ -19,7 +19,6 @@
 
 
 #include <math.h>
-#include "babl.h"
 #include "babl-internal.h"
 
 #define PIXELS    3
index e07d1b0496a14ff58616d2cad5744247b48280f0..a2f8d36086cb5d51400ea9dd4630fec421c92bfc 100644 (file)
@@ -19,7 +19,6 @@
 
 
 #include <math.h>
-#include "babl.h"
 #include "babl-internal.h"
 
 #define PIXELS 6
index 62714927c9a5a48c508f8329a9818acc2e549965..3f734f67f11ac843dd7ae13a34bcf10a19ac4766 100644 (file)
@@ -17,8 +17,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "babl.h"
-#include "babl-sanity.h"
 #include "babl-internal.h"
 
 int
index 1b24b24546c025590fb9c6006c2bca43e6e97bf6..19b5c25c9351e25f8a85791d2349f3b5f6a8d2f6 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <math.h>
-#include "babl.h"
 #include "babl-internal.h"
 
 #define PIXELS    6
index c01441400dd1d52c5bd6db84a12ec62e748a9631..8e7616413fe11f73770996ca62e3bd469219e7b7 100644 (file)
@@ -1,5 +1,4 @@
-#include "babl.h"
-#include "math.h"
+#include <math.h>
 #include "babl-internal.h"
 
 int OK=1;